<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <input type="text" v-model.number="num2">
    <input type="text" v-model.number="num">
    {{ num2 }}
  </div> 
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        num: 20
      },
      computed: {
       num2: {
         get(){
          //  提供值 
           return this.num/2
         },
         set(newVal){
            console.log('我改变了，值是'+newVal)
            this.num = newVal*2
           
         }
       }
      }
    })
    console.log(vm)
  </script>
</body>
</html>